package sphere.controller;

import java.awt.event.TextEvent;
import java.awt.event.TextListener;



import sphere.model.Sphere;
import sphere.view.SphereWindow;

public class SphereControler implements TextListener {//,KeyListener

	private SphereWindow sw;
	
	Sphere s;
	
	public SphereControler(SphereWindow sw) {
		this.sw=sw;
		s=new Sphere();
	}
	
	@Override
	public void textValueChanged(TextEvent arg0)
	{
		s.setRayon(Double.parseDouble(sw.getRayon()));
		sw.setSurface(""+s.calculerSurface());
		sw.setVolume(""+s.calculerVolume());
	}
	
	public void setView(SphereWindow sw){
		this.sw=sw;
	}
/*
	@Override
	public void keyPressed(KeyEvent arg0)
	{
		s.setRayon(Double.parseDouble(""+sw.getRayon()));
		sw.setSurface(""+s.calculerSurface());
		sw.setVolume(""+s.calculerVolume());
		//s.setS(Double.parseDouble(""+s.calculerSurface()));
		
		
	}

	@Override
	public void keyReleased(KeyEvent arg0)
	{
		// TODO Auto-generated method stub
		
	}

	@Override
	public void keyTyped(KeyEvent arg0)
	{
		// TODO Auto-generated method stub
		
	}
*/
}
